package com.tradeplus.admin.dao;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.tradeplus.admin.model.TownSize;

public class TownSizeDaoImpl implements TownSizeDao {
	
	private HibernateTemplate hibernateTemplate;

    public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
        this.hibernateTemplate = hibernateTemplate;
    }

	@Override
	public void saveTownSize(TownSize townSize) {
		hibernateTemplate.merge(townSize);
	}

	@Override
	public List<TownSize> loadTownSize() {
		return hibernateTemplate.find("from TownSize");
	}

	@Override
	public TownSize loadTownSizeById(Long townSizeId) {
		return hibernateTemplate.get(TownSize.class, townSizeId);
	}

	@Override
	public void deleteTownSize(Long townSizeId) {
		hibernateTemplate.delete(hibernateTemplate.get(TownSize.class, townSizeId));
	}

}
